import request from '@/utils/request'

// 查询档案借阅列表
export function listAmBorrow(query) {
  return request({
    url: '/am/amBorrow/list',
    method: 'get',
    params: query
  })
}

// 查询档案借阅详细
export function getAmBorrow(id) {
  return request({
    url: '/am/amBorrow/' + id,
    method: 'get'
  })
}

// 新增档案借阅
export function addAmBorrow(data) {
  return request({
    url: '/am/amBorrow',
    method: 'post',
    data: data
  })
}

// 修改档案借阅
export function updateAmBorrow(data) {
  return request({
    url: '/am/amBorrow',
    method: 'put',
    data: data
  })
}

// 删除档案借阅
export function delAmBorrow(id) {
  return request({
    url: '/am/amBorrow/' + id,
    method: 'delete'
  })
}

// 审核档案借阅
export function approveAmBorrow(data) {
  return request({
    url: '/am/amBorrow/approval',
    method: 'post',
    data,
  })
}

// 档案借出
export function borrowAmDescription(id) {
  return request({
    url: `/am/amBorrow/borrow_description?id=${id}`,
    method: 'post'
  })
}

// 档案归还
export function returnAmDescription(id) {
  return request({
    url: `/am/amBorrow/return_description?id=${id}`,
    method: 'post'
  })
}

// 借阅撤销
export function repealAmBorrow(id) {
  return request({
    url: `/am/amBorrow/repeal?id=${id}`,
    method: 'put'
  })
}

// 档案归还
export function getApprovalInfo(id) {
  return request({
    url: `/am/amBorrow/getApprovalInfo/${id}`,
    method: 'get'
  })
}

// 档案归还
export function getStatisticsData(data) {
  return request({
    url: `/am/amBorrow/borrow_statistics/`,
    method: 'post',
    data,
  })
}
